import React, { Component } from 'react';
import { StatusBar, Platform } from "react-native";
import { createStackNavigator, createAppContainer } from "react-navigation";
import { StatusBarConfig } from '../config/StatusBarConfig';
import Layout from './Layout'
import { SplashPage } from './SplashPage';
//import NDWLApp from './logistics/index'

import { LoginPage } from '../containers/auth/LoginPage'; // 登录
import { AuthenticationPages } from '../components/touch-id/AuthenticationPages'; // 指纹/人脸授权登录
import { gestureLogin } from '../containers/uc/gestureLogin'; // 指纹/人脸授权登录
import { PassWordPage } from '../containers/auth/PassWordPage';  // 修改密码
/*场景*/
const component = { SplashPage, LoginPage, AuthenticationPages, PassWordPage, Layout,gestureLogin }
// /*路由配置*/
const AppStack = createStackNavigator(component, {
	animationEnabled: false,
	initialRouteName: 'SplashPage', // 默认显示界面
	mode: 'card', // 页面切换模式, 左右是card(相当于iOS中的push效果), 上下是modal(相当于iOS中的modal效果)
	headerMode: 'screen', // 导航栏的显示模式, screen: 有渐变透明效果, float: 无透明效果, none: 隐藏导航栏
});

const AppContainer = createAppContainer(AppStack);

export default class App extends React.Component {
	render () {
		return <AppContainer onNavigationStateChange={(prevState, newState, action) => {
			let currRoute = newState.routes[newState.index];
			let willChangeRoute = currRoute.routeName;
			if (!willChangeRoute) return;
			let routeStyle = StatusBarConfig[willChangeRoute] || StatusBarConfig['default'];
			StatusBar.setBarStyle(routeStyle.barStyle);
			if (Platform.OS === 'android') {
				StatusBar.setBackgroundColor(routeStyle.backgroundColor);
			}
		}}
		/>;
	}
}

